package sicnu.cs.ich.log.service;

import com.github.pagehelper.PageInfo;
import sicnu.cs.ich.api.domain.entity.LoginLog;
import sicnu.cs.ich.api.domain.entity.OperationLog;
import sicnu.cs.ich.log.rest.form.LogPageParam;
import sicnu.cs.ich.log.rest.form.LoginPageParam;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;

/**
 * @author CaiKe
 * @date 2021/12/7 19:11
 */
public interface ILogService {

    /**
     * 获取操作日志
     *
     * @param pageParam
     * @return
     */
    PageInfo<OperationLog> getOperationLog(LogPageParam pageParam);

    PageInfo<LoginLog> getLoginLog(LoginPageParam pageParam);

    /**
     * 暂存实体
     *
     * @param operLog
     * @throws InterruptedException
     */
    void tempStoreOperationLog(OperationLog operLog) throws InterruptedException;
    void tempStoreLoginLog(LoginLog operLog) throws InterruptedException;

    /**
     * 将暂存的实体保存进数据库
     *
     * @throws IOException
     */
    void saveOperationLogs() throws IOException;
    void saveLoginLogs() throws IOException;

    /**
     * 关闭流
     */
    void closeStream() throws IOException;

    /**
     * 删除一段时间之前的SQL文件
     */
    void deleteOperationSQL(Long seconds);
    void deleteLoginSQL(Long seconds);

}